package com.ys.otms.controller;

import com.ys.otms.services.IBillsServices;
import com.ys.otms.services.IDetailedTestServices;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2018/10/31.
 */
@Controller
@RequestMapping("/detailed")
public class DetailedTestController {
    private static Logger logger = LoggerFactory.getLogger(DetailedTestController.class);

    @Autowired
    private IDetailedTestServices iDetailedTestServices;

    /**
     * 装货地实装货量排行
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("/selectOriginalVolumeOfGoodsRankings")
    @ResponseBody
    public JSONObject selectOriginalVolumeOfGoodsRankings(HttpServletRequest request) throws Exception{
        logger.info("DetailedTestController selectOriginalVolumeOfGoodsRankings start");
        JSONObject jsonDetail = new JSONObject();
        try {
            jsonDetail = iDetailedTestServices.selectOriginalVolumeOfGoodsRankings(request);
        } catch (Exception e) {
            logger.error("DetailedTestController selectOriginalVolumeOfGoodsRankings Exception",e);
            jsonDetail.put("SUCCESS",false);
            jsonDetail.put("MSG","查询数据失败！");
        }
        return jsonDetail;
    }

    /**
     * 卸货地实装货量排行
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("/selectDestinationVolumeOfGoodsRankings")
    @ResponseBody
    public JSONObject selectDestinationVolumeOfGoodsRankings(HttpServletRequest request) throws Exception{
        logger.info("DetailedTestController selectDestinationVolumeOfGoodsRankings start");
        JSONObject jsonDetail = new JSONObject();
        try {
            jsonDetail = iDetailedTestServices.selectDestinationVolumeOfGoodsRankings(request);
        } catch (Exception e) {
            logger.error("DetailedTestController selectDestinationVolumeOfGoodsRankings Exception",e);
            jsonDetail.put("SUCCESS",false);
            jsonDetail.put("MSG","查询数据失败！");
        }
        return jsonDetail;
    }

    /**
     * 卸卸量趋势图
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("/selectLoadingAndUploadingTrendMap")
    @ResponseBody
    public JSONObject selectLoadingAndUploadingTrendMap(HttpServletRequest request) throws Exception{
        logger.info("DetailedTestController selectLoadingAndUploadingTrendMap start");
        JSONObject jsonDetail = new JSONObject();
        try {
            jsonDetail = iDetailedTestServices.selectLoadingAndUploadingTrendMap(request);
        } catch (Exception e) {
            logger.error("DetailedTestController selectLoadingAndUploadingTrendMap Exception",e);
            jsonDetail.put("SUCCESS",false);
            jsonDetail.put("MSG","查询数据失败！");
        }
        return jsonDetail;
    }


    /**
     * 卸卸量趋势图
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("/selectTransportTimeRanking")
    @ResponseBody
    public JSONObject selectTransportTimeRanking(HttpServletRequest request) throws Exception{
        logger.info("DetailedTestController selectTransportTimeRanking start");
        JSONObject jsonDetail = new JSONObject();
        try {
            jsonDetail = iDetailedTestServices.selectTransportTimeRanking(request);
        } catch (Exception e) {
            logger.error("DetailedTestController selectTransportTimeRanking Exception",e);
            jsonDetail.put("SUCCESS",false);
            jsonDetail.put("MSG","查询数据失败！");
        }
        return jsonDetail;
    }

}
